<template>
  <router-view/>
</template>

<script lang="ts">
  import { defineComponent, provide } from "vue";
  import { getApp } from "@/common/hooks";
  import { Language } from "@/common/lang";

  export default defineComponent({
    components: {},
    setup() {
      const lang = localStorage.getItem(getApp().System.STORE_KEY.LANGUAGE) || Language.zh;

      const { proxy } = getApp(["Vm"]).Vm!;
      // TODO 需要取消初始化
      const setLanguage = (lang: string) => {
        localStorage.setItem(getApp().System.STORE_KEY.LANGUAGE, lang);
        proxy!.$i18n.locale = lang;
      }

      provide('setLanguage', setLanguage);

      (() => {
        setLanguage(lang);
      })();
    }
  });
</script>

<style lang="scss">
  /*初始化input placeholder*/
  input::placeholder {
    color: $color-gray-9;
  }
</style>
